package entity.maintenance.dto;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import entity.maintenance.MaintenanceExperience;
import entity.maintenance.MaintenanceLevel;

/**
 * @ClassName: MaintenanceExperienceQueryWrapper
 * @Description: //TODO
 * @Author: 18438
 * @Date: 2023/6/14 14:26
 **/

public class MaintenanceExperienceQueryWrapper {
    public QueryWrapper<MaintenanceExperience> conditional(MaintenanceExperience experience) {
        QueryWrapper<MaintenanceExperience> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("delete_flag", 0);
        //如果保养经验编码不为空，则进行模糊查
        if (experience.getExperienceCoding() != null) {
            queryWrapper.like("experience_coding", experience.getExperienceCoding());
        }
        if (experience.getExperienceName() != null) {
            queryWrapper.like("experience_name", experience.getExperienceName());
        }
        if (experience.getEquipmentCoding()!=null){
            queryWrapper.like("equipment_coding",experience.getEquipmentCoding());
        }
        if (experience.getAssociatedApparatus()!=null){
            queryWrapper.like("associated_apparatus",experience.getAssociatedApparatus());
        }
        if (experience.getEquipmentType()!=null){
            queryWrapper.eq("equipment_type",experience.getEquipmentType());
        }
        if (experience.getExperienceState()!=null){
            queryWrapper.eq("experience_state",experience.getExperienceState());
        }

        return queryWrapper;
    }
}
